﻿using System;
using System.Collections.Generic;
using System.Text;
using My.GenCode.Entities;
using My.GenCode.Interface;

namespace My.GenCode.Templates
{
    public class GenInterfaceClass : CodeTemplate
    {
        #region 覆盖父类的方法

        public GenInterfaceClass(string tpl, EntityInfo info,string desc) : base(tpl, info,desc) { }

        protected override string ProcTemplate()
        {
            _tpl = _tpl.Replace("<FileName>", _nh.InterfaceFileName);                // 处理<FileName>标签
            _tpl = _tpl.Replace("<NameSpace>", _nh.NameSpace);                       // 处理<NameSpace>标签
            _tpl = _tpl.Replace("<ClassName>", _nh.InterfaceName);                   // 处理<ClassName>标签
            _tpl = _tpl.Replace("<EntityName>", _nh.EntityName);                     // 处理<EntityName>标签

            _tpl = _tpl.Replace("<CreateMethodSign>", _nh.CreateMethodSign);         // 处理<CreateMethodSign>标签
            _tpl = _tpl.Replace("<UpdateMethodSign>", _nh.UpdateMethodSign);         // 处理<UpdateMethodSign>标签
            _tpl = _tpl.Replace("<DeleteMethodSign>", _nh.DeleteMethodSign);         // 处理<DeleteMethodSign>标签
            _tpl = _tpl.Replace("<ReadDetailMethodSign>", _nh.ReadDetailMethodSign); // 处理<ReadDetailMethodSign>标签
            _tpl = _tpl.Replace("<ReadListMethodSign>", _nh.ReadListMethodSign);     // 处理<ReadListMethodSign>标签
            _tpl = _tpl.Replace("<ReadCountMethodSign>", _nh.ReadCountMethodSign);   // 处理<ReadCountMethodSign>标签
            
            return _tpl;
        }

        protected override string OutputFilename()
        {
            return @"Domain\Interfaces\" + _nh.InterfaceFileName;
        }

        #endregion
    }
}